package org.codefinger.dao.impl.sql.ast;

import org.codefinger.dao.impl.SQLVisitor;
import org.codefinger.dao.impl.sql.Expression;

public class IndexParamExpression implements Expression {

	private int	index;

	public IndexParamExpression(int	index) {
		super();
		this.index = index;
	}

	@Override
	public boolean matchVisit(SQLVisitor visitor) {
		if (visitor.matchParam(index)) {
			visitor.appendSQL('?');
			return true;
		}
		return false;
	}

	@Override
	public void visit(SQLVisitor visitor) {
		visitor.addParamForced(index);
		visitor.appendSQL('?');
	}

}
